<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('邀请页面')"/>
    <th:block th:include="include :: datetimepicker-css"/>
</head>
<style>
    .go{
        height: 200px;
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: center;
    }
</style>
<body>
<div>
    <div class="col-sm-8">
        <form class="form-horizontal m" id="form-invite">
            <div class="form-group">
                <div class="col-sm-4" style="">
                    <input name="mobilePhone" class="form-control" type="text" placeholder="请填入您的手机号">
                </div>
            </div>
        </form>
    </div>
    <div class="go">
        <a class="btn btn-info" onclick="submit()">
            <i class="fa fa-arrow-right"></i> 开始填写
        </a>
    </div>
</div>

<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    let prefix = '/ry/rnx/register/';
    $("#form-invite").validate({
        focusCleanup: true,
        rules: {
            mobilePhone: {
                required: true,
                isPhone: true
            }
        }
    });
    //提交
    function submit() {
        if ($.validate.form()) {
            let phone = $('input[name="mobilePhone"]').val();
            let param = {
                phone : phone
            };
            $.operate.post(prefix + "check", param,(r) => {
                if(r.code == 0){
                    //跳转到填写
                    window.location.href = prefix + "add/"+phone;
                }else{
                    $.modal.alertError(r.msg);
                }
            });
        }
    }
</script>
</body>
</html>